package com.thomasbrault.net 
{
	import flash.net.URLRequest;
	import flash.net.URLVariables;

	/**
	 * @author t.brault
	 */
	public class URLRequestHelper 
	{
		public static function getUrlRequest ( $url : String, $params : Object = null, $method : String = '' ) : URLRequest
		{
			var req : URLRequest = new URLRequest($url);
			req.method = $method;
			
			if ( $params != null )
			{
				var vars : URLVariables = new URLVariables();
				for ( var i in $params )
				{
					vars[i] = $params[i];
				}
				
				req.data = vars;
			}
			
			return req;
		}
	}
}
